package com.kele.config;

import com.kele.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author chunhui.li
 * @date 2021/10/18 15:10
 * @Description
 * @ClassName LoginConfig
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {


    @Bean
    public LoginInterceptor initAuthInterceptor(){
        return new LoginInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(initAuthInterceptor()).addPathPatterns("/test/**")
                .excludePathPatterns("/login/**");
    }
}
